<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>弓友之家</title>
    <link rel="stylesheet" href="css/mui.css" />
    <link rel="stylesheet" href="fonts/iconfont.css" />
    <link rel="stylesheet" href="css/style.css" />
    <style>
    	.mui-slider-indicator{bottom: 8px;}
    	.head1{background: #F7F7F7;}
    	.mui-segmented-control.mui-scroll-wrapper{height: 135px; padding-top: 10px;}
    	.mui-segmented-control.mui-segmented-control-inverted .mui-control-item{padding: 0; padding-left: 10px; width: 85px;}
    	.mui-segmented-control.mui-segmented-control-inverted .mui-control-item .img{width: 75px; height: 75px; border-radius: 5px; overflow: hidden;}
    	.mui-control-item .img img{width: 100%; border-radius: 5px; height: 100%;}
		.mui-control-item h4{font-weight: 400; color: #1A1A1A; font-size: 14px; text-align: center;}
		.mui-control-item p{color: #FF4200; margin-bottom: 0; line-height: 15px; font-size: 12px;}
		.index-goods{background: none;}
    </style>
</head>
<body>
	<div class="index-serach mui-clearfix mui-bar-nav">
		<form class="mui-pull-left">
			<input type="text" id="keys" placeholder="输入您想要查找的内容" />
			<select id="type">
				<option data-type="1">商品</option>
				<option data-type="2">会员</option>
				<option data-type="3">文章</option>
			</select>
			<button type="button" onclick="search()" class="iconfont icon-sousuo"></button>
		</form>
		<span class="mui-pull-right on" onclick="window.location.href='chat.html'"><i class="iconfont icon-xiaoxi"></i></span>
	</div>
	<div class="mui-content">
		<!--轮播图-->
		<div id="slider" class="mui-slider" >
			<div class="mui-slider-group mui-slider-loop">
				
			</div>
			<div class="mui-slider-indicator">
				
			</div>
		</div>
		<!--新品推荐-->
		<div class="goods-new">
			<div class="head1 mui-clearfix">
				新品推荐
				<a data-href="goods-list.html">查看更多<i class="iconfont icon-lunbofanyeanniu_you"></i></a>
			</div>
			<div class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
			    <div class="mui-scroll">
			        
			    </div>
			</div>
		</div>
		<!--精品推荐-->
		<div class="goods-hot">
			<div class="head1 mui-clearfix">
				精品推荐
				<a data-href="goods-list.html">查看更多<i class="iconfont icon-lunbofanyeanniu_you"></i></a>
			</div>
			<div class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
			    <div class="mui-scroll">
			       
			    </div>
			</div>
		</div>
		<div class="index-goods">
			<div class="mui-clearfix">
				
			</div>
		</div>
	</div>
	<br /><br /><br />
	<!--兑换弹出框-->
	<!--<div class="buy-box mui-hidden">
		<div class="text">您是想如何购买商品？</div>
		<div class="mui-row">
			<div class="mui-col-xs-6">
				<button type="button" data-gid="" class="dhbtn">立即兑换</button>
			</div>
			<div class="mui-col-xs-6">
				<button type="button" data-tburl="" class="dhbtn1">立即购买</button>
			</div>
		</div>
	</div>-->
	
	<!--底部导航-->
	<footer class="mui-row">
		<div class="mui-col-xs-3"><a data-href="index.html">
			<img src="images/f1.png" class="old" />
			<img src="images/f1_on.png" class="hover" />
			<p>首页</p>
		</a></div>
		<div class="mui-col-xs-3 on"><a data-href="shop.html">
			<img src="images/f2.png" class="old" />
			<img src="images/f2_on.png" class="hover" />
			<p>商城</p> 
		</a></div>
		<div class="mui-col-xs-3"><a data-href="experience.html">
			<img src="images/f3.png" class="old" />
			<img src="images/f3_on.png" class="hover" />
			<p>弓略</p>
		</a></div>
		<div class="mui-col-xs-3"><a data-href="chat.html">
			<img src="images/f3.png" class="old" />
			<img src="images/f3_on.png" class="hover" />
			<p>在线聊天</p>
		</a></div>
		<div class="mui-col-xs-3"><a data-href="user.html">
			<img src="images/f4.png" class="old" />
			<img src="images/f4_on.png" class="hover" />
			<p>个人中心</p>
		</a></div>
	</footer>
	<script type="text/javascript" src="js/mui.min.js" ></script>
	<script type="text/javascript" src="js/jquery-1.8.3.min.js" ></script>
	<script type="text/javascript" src="js/jquery.SuperSlide.2.1.1.js" ></script>
	<script type="text/javascript" src="js/common.js" ></script>
	<script type="text/javascript" charset="utf-8">
      	mui.init();
      	mui.ajax(H_SRC+'/amier/index/shops',{
			data:{
				token:token
			},
			dataType:'json',
			type:'post',
			timeout:10000,             
			success:function(data){
				var dataurl=data.data;
				if(data.code == 1){
					//轮播图
					var lb="",dot="";
					lb+='<div class="mui-slider-item mui-slider-item-duplicate"><img src="'+H_SRC+''+dataurl.lunbo[dataurl.lunbo.length-1].img_url+'"></div>'
					for(var i=0;i<dataurl.lunbo.length;i++){
						lb+='<div class="mui-slider-item"><img src="'+H_SRC+''+dataurl.lunbo[i].img_url+'" /></div>';
						dot+='<div class="mui-indicator"></div>';
					}
					lb+='<div class="mui-slider-item mui-slider-item-duplicate"><img src="'+H_SRC+''+dataurl.lunbo[0].img_url+'"></div>';
					$(".mui-slider-group").html(lb);
					$(".mui-slider .mui-slider-indicator").html(dot);
					$(".mui-slider-group").on("tap","a",function(){
						gid=$(this).attr("data-href");
						mui.openWindow({
							url:'goods-list-page.html',
							id:'goods-list-page.html',
							createNew:true,
							show: {
								autoShow: true,
								aniShow: 'slide-in-right',
								duration: 200,
							},
							extras:{
								gid:gid
							}
						});
					})
					var slider = mui("#slider");
      				slider.slider({interval: 4000}); 
      				//新品
      				var xp="";
      				for(var i=0;i<dataurl.xinpin.length;i++){
						xp+='<a class="mui-control-item" data-id="'+dataurl.xinpin[i].id+'" data-taobao="'+dataurl.xinpin[i].id+'">';
			            xp+='<div class="img"><img src="'+H_SRC+''+dataurl.xinpin[i].img+'"/></div>';
			            xp+='<h4 class="mui-ellipsis">'+dataurl.xinpin[i].goodsName+'</h4>';
			            xp+='<p class="mui-ellipsis">'+parseInt(dataurl.xinpin[i].price)+'</p></a>';
					}
      				$(".goods-new .mui-scroll").html(xp);
      				//精品
      				var jp="";
      				for(var i=0;i<dataurl.jingpin.length;i++){
						jp+='<a class="mui-control-item" data-id="'+dataurl.jingpin[i].id+'" data-taobao="'+dataurl.jingpin[i].id+'">';
			            jp+='<div class="img"><img src="'+H_SRC+''+dataurl.jingpin[i].img+'"/></div>';
			            jp+='<h4 class="mui-ellipsis">'+dataurl.jingpin[i].goodsName+'</h4>';
			            jp+='<p class="mui-ellipsis">'+parseInt(dataurl.jingpin[i].price)+'</p></a>';
					} 
      				$(".goods-hot .mui-scroll").html(jp);
      				
      				var goods="";
      				for(var i=0;i<dataurl.sel.length;i++){
      					goods+='<div class="one" data-id="'+dataurl.sel[i].id+'" data-taobao="'+dataurl.sel[i].id+'">';
						goods+='<a class="img"><img src="'+H_SRC+''+dataurl.sel[i].img+'"/></a>';
						goods+='<div class="text">';
						goods+='<h4 class="mui-ellipsis"><a data-id="'+dataurl.sel[i].id+'" >'+dataurl.sel[i].goodsName+'</a></h4>';
						goods+='<h5 class="mui-clearfix">';
						goods+='<span>￥'+parseInt(dataurl.sel[i].price)+'</span>';
						if(dataurl.sel[i].isShipping==1){
							var by="<i>包邮</i>";
						}else{
							var by=""
						}
						goods+=by+'';
						goods+='<button type="button">立即兑换</button>';
						goods+='</h5></div></div>';
      				}
      				$(".index-goods .mui-clearfix").html(goods);
				}else{
					mui.toast(data.msg);
				}
			},
			error:function(){
				
			}
		}) 
		
      	var mask=mui.createMask(callback);
      	function callback(){
      		$(".first-login").addClass("mui-hidden");
      		$(".buy-box").addClass("mui-hidden");
      	}
      	
      	$(".head1").on("tap","a",function(){ 
      		var href=$(this).attr("data-href");
      		mui.openWindow({
				url:href,
				id:href,
				createNew:true,
				show: {
					autoShow: true,
					aniShow: 'slide-in-right',
					duration: 200
				}
			});
      	})
      	
      	$(".index-goods").on("tap",".one",function(){
      		var gid=$(this).attr("data-id");
//    		var tburl=$(this).attr("data-taobao");
//    		$(".dhbtn").attr("data-gid",gid);
//    		$(".dhbtn1").attr("data-tburl",tburl);
//    		mask.show();
//    		$(".buy-box").removeClass("mui-hidden");
			mui.openWindow({
				url:'goods-list-page.html',
				id:'goods-list-page.html',
				createNew:true,
				show: {
					autoShow: true,
					aniShow: 'slide-in-right',
					duration: 200,
				},
				extras:{
					gid:gid
				}
			});
      	})
      	$(".goods-hot .mui-scroll").on("tap","a",function(){
      		var gid=$(this).attr("data-id");
//    		var tburl=$(this).attr("data-taobao");
//    		$(".dhbtn").attr("data-gid",gid);
//    		$(".dhbtn1").attr("data-tburl",tburl);
//    		mask.show();
//    		$(".buy-box").removeClass("mui-hidden");
//    		$(this).removeClass("mui-active");
			mui.openWindow({
				url:'goods-list-page.html',
				id:'goods-list-page.html',
				createNew:true,
				show: {
					autoShow: true,
					aniShow: 'slide-in-right',
					duration: 200,
				},
				extras:{
					gid:gid
				}
			});
      	})
      	$(".goods-new .mui-scroll").on("tap","a",function(){
      		var gid=$(this).attr("data-id");
//    		var tburl=$(this).attr("data-taobao");
//    		$(".dhbtn").attr("data-gid",gid);
//    		$(".dhbtn1").attr("data-tburl",tburl);
//    		mask.show();
//    		$(".buy-box").removeClass("mui-hidden");
//    		$(this).removeClass("mui-active");
			mui.openWindow({
				url:'goods-list-page.html',
				id:'goods-list-page.html',
				createNew:true,
				show: {
					autoShow: true,
					aniShow: 'slide-in-right',
					duration: 200,
				},
				extras:{
					gid:gid
				}
			});
      	})
      	$(".dhbtn").on("tap",function(){ 
      		var gid=$(this).attr("data-gid");
      		mui.openWindow({
				url:'dhaddress.html',
				id:'dhaddress.html',
				createNew:true,
				extras:{
					gid:gid
				},
				show: {
					autoShow: true,
					aniShow: 'slide-in-right',
					duration: 200
				}
			});
      	})
      	$(".dhbtn1").on("tap",function(){
      		var link=$(this).attr("data-tburl");
      		mui.openWindow({
				url:link,
				id:link,
				createNew:true,
				show: {
					autoShow: true,
					aniShow: 'slide-in-right',
					duration: 200
				}
			});
      	})
      	function search(){
      		var keys=$("#keys").val();
      		if(keys==""){
      			mui.toast("搜索内容不能为空");
      			return false;
      		}
      		var type=$("#type").children("option:selected").attr("data-type");
      		mui.openWindow({
				url:'search.html',
				id:'search.html',
				createNew:true,
				extras:{
					keys:keys,
					type:type
				},
				show: {
					autoShow: true,
					aniShow: 'slide-in-right',
					duration: 200
				}
			});
      	}
    </script>
</body>
</html>